import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

public class SendMailSSL {
 public static void main(String[] args) {

 String to="mhshkumar270@gmail.com";//change accordingly
 String t1= "mahesh.it14@gmail.com";
 String t2=  "malhothrasuraindir@gmail.com";
 String t3=  "manasa.karanth.p@gmail.com";
 String t4 = "felightz@gmail.com";

//Get the session object
  Properties props = new Properties();
  props.put("mail.smtp.host", "smtp.gmail.com");
  props.put("mail.smtp.socketFactory.port", "465");
  props.put("mail.smtp.socketFactory.class",
        	"javax.net.ssl.SSLSocketFactory");
  props.put("mail.smtp.auth", "true");
  props.put("mail.smtp.port", "465");
 
  Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
   protected PasswordAuthentication getPasswordAuthentication() {
   return new PasswordAuthentication("mahesh.it14@gmail.com","9790437936");//change accordingly
   }
  });
 
//compose message
  try {
   MimeMessage message = new MimeMessage(session);
   message.setFrom(new InternetAddress("mahesh.it14@gmail.com"));//change accordingly
   message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
   message.addRecipient(Message.RecipientType.TO,new InternetAddress(t1));
   message.addRecipient(Message.RecipientType.TO,new InternetAddress(t4));

   message.setSubject("Hi");
   message.setText("Sorry Disrurbance just to check for multi recipient....... If u see this reply me..");
   message.
   
   //send message
   Transport.send(message);

   System.out.println("message sent successfully");
 
  } catch (MessagingException e) {throw new RuntimeException(e);}
 
 }
}